/*
 * EDAS2 - TetraTech, Inc.
 *
 * Distributable under GPL license.
 * See terms of license at gnu.org.
 */
package com.tetratech.edas2.model;

import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import org.hibernate.validator.Length;
import org.hibernate.validator.NotNull;

/**
 * SamplingCollectionEquipment generated by hbm2java
 */
@Entity
@Table(name = "ED_SAMPLE_COLLECTION_EQUIP")
public class SamplingCollectionEquipment extends AttributableUpdateRetireEntity
		implements
			java.io.Serializable {

	private Long uid;
	private SamplingCollectionEquipmentType type;
	private String name;
	private String description;
	private Set<Activity> activities = new HashSet<Activity>(0);

	public SamplingCollectionEquipment() {
	}

	public SamplingCollectionEquipment(Long uid,
			SamplingCollectionEquipmentType type, String name) {
		this.uid = uid;
		this.type = type;
		this.name = name;
	}

	@Id
	@Column(name = "SCEQP_UID", unique = true, nullable = false, precision = 6, scale = 0)
	@NotNull
	public Long getUid() {
		return this.uid;
	}

	public void setUid(Long uid) {
		this.uid = uid;
	}
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "SCETYP_UID", nullable = false)
	@NotNull
	public SamplingCollectionEquipmentType getType() {
		return this.type;
	}

	public void setType(SamplingCollectionEquipmentType type) {
		this.type = type;
	}

	@Column(name = "SCEQP_NAME", nullable = false, length = 40)
	@NotNull
	@Length(max = 40)
	public String getName() {
		return this.name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@Column(name = "SCEQP_DESC", length = 300)
	@Length(max = 300)
	public String getDescription() {
		return this.description;
	}

	public void setDescription(String description) {
		this.description = description;
	}
	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "samplingCollectionEquipment")
	public Set<Activity> getActivities() {
		return this.activities;
	}

	public void setActivities(Set<Activity> activities) {
		this.activities = activities;
	}

}
